﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MDeskTop
{
    public partial class DesktopControl : UserControl
    {
        public DesktopControl()
        {
            InitializeComponent();
        }

        public void UpdateControl()
        {
            Invalidate();
        }

        public void Add(Image image)
        {
            Rectangle rectangle = new Rectangle(new Point(0, 0), image.Size);
            position(ref rectangle);
           // Images.Add(new DesktopItem(image, rectangle));
        }

        private void position(ref Rectangle rect)
        {
            Rectangle interRectangle;
         //   foreach (var item in Images)
         //   {
         //       Rectangle rectangle = item.Rectangle;
         //       while (rectangle.IntersectsWith(rect))
         //       {
         //           interRectangle = Rectangle.Intersect(rect, rectangle);
         //           rect.X += interRectangle.Width;
         //
         //           if (rect.X > Width)
         //           {
         //               rect.X = 0;
         //               rect.Y += interRectangle.Y;
         //           }
         //
         //       }
         //   }
        }

        private void DesktopControl_Paint(object sender, PaintEventArgs e)
        {
            //Rectangle rectangle = new Rectangle(new Point(0, 0), new Size(100, 100));
            //position(ref rectangle);
            //rectangles.Add(rectangle);

//            foreach (var image in Images)
//            {
//                e.Graphics.DrawImage(image.Image, image.Rectangle);
//            }


        }
    }
}